package com.ms.p2p.bean;



import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class PageBean implements Serializable {

	private List<?> list = new ArrayList();// 数据List


	public PageBean(List<?> list) {
		super();
		this.list = list;
	}

	public PageBean() {
		super();
	}

	public List<?> getList() {
		return list;
	}

	public void setList(List<?> list) {
		this.list = list;
	}

	private static final long serialVersionUID = 1L;

	private int currentPage = 1;

	private Integer pageSize = 15;//每页显示条数

	private int begin;// 起始行

	private int totalCount;// 总行数





	private int totalPage;// 总页数

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		if(currentPage!=null)
			this.currentPage = currentPage;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public boolean isLast(){
		return (getCurrentPage()==getTotalPage());
	}
	/**
	 * 获取开始条数（当前页-1*每页条数）
	 * @return
	 */
	public int getBegin() {
		if(pageSize==null){
			return 1;
		}
		begin = (currentPage - 1) * pageSize;
		return begin;
	}

	public void setBegin(int begin) {
		this.begin = begin;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	/**
	 * 获取最大页数（已判断是否整除+1）
	 * @return
	 */
	public int getTotalPage() {
		if (totalCount % pageSize == 0) {
			totalPage = totalCount / pageSize;
		} else {
			totalPage = totalCount / pageSize + 1;
		}
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
